﻿using System.Collections.Generic;
using SDCloudSolution.SDCloud.Entities.Identity.OAuth;

namespace SDCloudSolution.SDCloud.BusinessLayer.Interfaces
{
    /// <summary>
    /// Provides methods for works with <see cref="ClientApplicationEntity"/>.
    /// </summary>
    public interface IClientApplicationComponent
    {
        /// <summary>
        /// Validates the client application credentials.
        /// </summary>
        /// <param name="clientId">The client identifier.</param>
        /// <param name="clientSecret">The client secret.</param>
        bool ValidateApplication(string clientId, string clientSecret);

        /// <summary>
        /// Find a <see cref="ClientApplicationEntity"/> by specific client identifier.
        /// </summary>
        /// <param name="clientId">The client identifier.</param>
        ClientApplicationEntity GetByClientId(string clientId);

        /// <summary>
        /// Finds <see cref="ClientApplicationEntity"/>'s that attached to specific user.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <returns></returns>
        IList<ClientApplicationEntity> GetByUserId(int userId);

        /// <summary>
        /// Generates the application for user.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        ClientApplicationEntity GenerateApplicationForUser(int userId);
    }
}
